

export const trueUrl = (objUrl) => {
  let arr = []
  let urlstr = ''
  let isTrue = false
  let urlRegex = /(http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#\u4e00-\u9fa5]*[\w\-\@?^=%&/~\+#])/
  // let urlRegex = /^((https?):\/\/)?[a-zA-Z0-9._%+-]+(\.[a-zA-Z]{2,}){1,3}(\/[a-zA-Z0-9&-?%@./#=_]*)?$/
  if (objUrl.indexOf('/zxchhwy') > -1) {
    arr = objUrl.split('/zxchhwy')
    urlstr = 'https://zxch.cpolar.cn' + arr[1]

    // isTrue = urlRegex.test(urlstr) ? true : false
  }
  else if (objUrl.indexOf('/zxchjfj') > -1) {
    arr = objUrl.split('/zxchjfj')
    urlstr = 'http://139.9.173.189:8090' + arr[1]
    // isTrue = urlRegex.test(urlstr) ? true : false
  }
  else if (objUrl.indexOf('/zxchjfn') > -1) {
    arr = objUrl.split('/zxchjfn')
    urlstr = 'http://139.9.173.189:8091' + arr[1]
    // isTrue = urlRegex.test(urlstr) ? true : false
  }
  else if (objUrl.indexOf('/zxchjf') > -1) {
    arr = objUrl.split('/zxchjf')
    urlstr = 'http://139.9.173.189:8080' + arr[1]
    // isTrue = urlRegex.test(urlstr) ? true : false
  }
  else if (objUrl.indexOf('/ceshi') > -1) {
    arr = objUrl.split('/ceshi')
    urlstr = '139.9.173.189:81' + arr[1]
    // isTrue = urlRegex.test(urlstr) ? true : false
  }
  else if (objUrl.indexOf('/gucheng') > -1) {
    arr = objUrl.split('/gucheng')
    urlstr = '192.168.110.100:81' + arr[1]
    // isTrue = urlRegex.test(urlstr) ? true : false
  }
  else {
    ElMessage({type: 'warning',message: '该资源禁止上传!'});
    return
  }
  return urlstr
}
